<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:display="http://www.w3.org/1999/xhtml"
      xmlns:div.display="http://www.w3.org/1999/xhtml" xmlns:row.display="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>还款录入</title>

    <!-- Bootstrap Core CSS -->
    <link th:href="@{/vendor/bootstrap/css/bootstrap.min.css}" rel="stylesheet">

    <!-- MetisMenu CSS -->
    <link th:href="@{/vendor/metisMenu/metisMenu.min.css}" rel="stylesheet">

    <!-- Custom CSS -->
    <link th:href="@{/dist/css/sb-admin-2.css}" rel="stylesheet">

    <!-- Custom Fonts -->
    <link th:href="@{/vendor/font-awesome/css/font-awesome.min.css}" rel="stylesheet" type="text/css">

    <!--bootstrap-table CSS-->
    <link th:href="@{vendor/bootstrap/css/bootstrap-table.css}" rel="stylesheet" type="text/css">

    <link th:href="@{/vendor/datepicker/datepicker3.css}" rel="stylesheet" type="text/css">

    <!-- jQuery -->
    <script th:src="@{/vendor/jquery/jquery.min.js}"></script>

    <!-- Bootstrap Core JavaScript -->
    <script th:src="@{/vendor/bootstrap/js/bootstrap.min.js}"></script>

    <!-- Metis Menu Plugin JavaScript -->
    <script th:src="@{/vendor/metisMenu/metisMenu.min.js}"></script>

    <!-- Custom Theme JavaScript -->
    <script th:src="@{/dist/js/sb-admin-2.js}"></script>

    <script th:src="@{/vendor/datepicker/bootstrap-datepicker.js}"></script>

    <!--bootstrap-table JavaScript-->
    <script th:src="@{vendor/bootstrap/js/bootstrap-table.js}"></script>

    <!--bootstrap-table中文 JavaScript-->
    <!--<script th:src="@{vendor/bootstrap/js/bootstrap-table-CN.js}"></script>-->

    <style>
        #repaymentSearch {
            border: 1px solid #DDDDDD;
        }

        /*divide*/
        #parentDiv {
            width: 30%;
            float: left;
            /*border: 1px solid #DDDDDD;*/
            height: 670px;
        }

        /*searchArea*/
        #searchbar {
            transform: scale(0.9);
            -ms-transform: scale(0.9); /* IE 9 */
            -moz-transform: scale(0.9); /* Firefox */
            -webkit-transform: scale(0.9); /* Safari and Chrome */
            -o-transform: scale(0.9); /* Opera */
            /*position: absolute;*/
            width: auto;
            height: auto;
            border: 1px solid #DDDDDD;
        }

        #searchInfo {
            float: left;
            /*border: 1px solid #DDDDDD;*/
            height: 60%;
            width: 100%;
        }

        #tableDiv {
            float: left;
            /*border: 1px solid #DDDDDD;*/
            height: 40%;
            width: 100%;
        }

        #divideLine {
            width: 2%;
            height: 670px;
            padding-top: 0px;
            /*background-color: #0c0c0c;*/
            position: absolute;
            /*cursor: e-resize;*/
        }

        #iframeMapping {
            width: 69%;
            height: 670px;
            padding-top: 0px;
            float: right;
            /*border: 1px solid #DDDDDD;*/
        }
    </style>

    <script>
        $(function () {


            var Url = '/repaymentSearch/Search?'
                + 'dwndate=' + $('#dwndate').val()
                + '&&matdate=' + $('#matdate').val()
                + '&&custcod=' + $('#custcod').val()
                + '&&refno=' + $('#refno').val();
            $('#tb_repaymentSearch').bootstrapTable({
                url: Url,         //请求后台的URL（*）
                method: 'get',                      //请求方式（*）
//                toolbar: '#toolbar',                //工具按钮用哪个容器
                striped: true,                      //是否显示行间隔色
                cache: false,                       //是否使用缓存，默认为true，所以一般情况下需要设置一下这个属性（*）
                pagination: true,                   //是否显示分页（*）
                sortable: false,                     //是否启用排序
                sortOrder: "asc",                   //排序方式
                queryParams: queryParams,//传递参数（*）
                responseHandler:responseHandler,
                sidePagination: "server",           //分页方式：client客户端分页，server服务端分页（*）
                pageNumber: 1,                       //初始化加载第一页，默认第一页
                pageSize: 10,                       //每页的记录行数（*）
                pageList: [10, 25, 50, 100],        //可供选择的每页的行数（*）
                search: false,                       //是否显示表格搜索，此搜索是客户端搜索，不会进服务端，所以，个人感觉意义不大
                strictSearch: true,
                showColumns: false,                  //是否显示所有的列
//                showRefresh: false,                  //是否显示刷新按钮
                minimumCountColumns: 2,             //最少允许的列数
                clickToSelect: false,                //是否启用点击选中行
                height: 500,                        //行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
                uniqueId: "refno",                     //每一行的唯一标识，一般为主键列
                showToggle: false,                    //是否显示详细视图和列表视图的切换按钮
                cardView: false,                    //是否显示详细视图
                detailView: false,                   //是否显示父子表
                columns: [
//                    {
//                    checkbox: true
//                },
                    {
                    field: 'refno',
                    title: '贷款编号'
                }, {
                    field: 'custcod',
                    title: '客户号'
                }, {
                    field: 'cusnm',
                    title: '中文名字'
                }, {
                    field: 'flstscd',
                    title: '贷款状态'
                }],

                onClickRow: function (row) {
                    $('#iframeMapping').attr('src', "/repaymentInput?refno=" + row.refno);
                }
            });

//            $('#dwndate').datepicker({
//                language: 'zh-CN',
//                format: 'yyyymmdd',
//                todayBtn: "linked",
//                autoclose: true,
//                todayHighlight: true,
//                endDate: new Date()
//            }).on('changeDate', function (e) {
//                var startTime = e.date;
//                $('#matdate').datepicker('setStartDate', startTime);
//            });
//
//            $('#matdate').datepicker({
//                language: 'zh-CN',
//                format: 'yyyymmdd',
//                todayBtn: "linked",
//                autoclose: true,
//                todayHighlight: true,
//                endDate: new Date()
//            }).on('changeDate', function (e) {
//                var endTime = e.date;
//                $('#dwndate').datepicker('setEndDate', endTime);
//            });
        });

        function queryParams(params) {
            var temp = {   //这里的键的名字和控制器的变量名必须一直，这边改动，控制器也需要改成一样的
                limit: params.limit,   //页面大小
                offset: params.offset / params.limit + 1,  //页码
//                    refno: $("#refno").val(),
                //                    statu: $("#txt_search_statu").val()
            };
            return temp;
        }

        //请求成功方法
        function responseHandler(result) {
            var errCode = result.errCode;//在此做了错误代码的判断
            if (errCode != 0) {
                alert("错误代码" + errCode);
                return;
            }
            //如果没有错误则返回数据，渲染表格
            return {
                total: result.dataLength, //总页数,前面的key必须为"total"
                rows: result.rowDatas //行数据，前面的key要与之前设置的dataField的值一致.
            };
        };

        $(function () {
            $('#search').click(function () {
                var Url = '/repaymentSearch/Search?'
                    + 'dwndate=' + $('#dwndate').val()
                    + '&&matdate=' + $('#matdate').val()
                    + '&&custcod=' + $('#custcod').val()
                    + '&&refno=' + $('#refno').val();
                $('#tb_repaymentSearch').bootstrapTable("refresh", {url: Url});
            });

            $('#close').click(function () {
                if (navigator.appName == "Netscape") {
                    window.location.href = 'about:blank ';
                } else if (navigator.appName == "Firefox") {
                    window.location.href = 'about:blank ';
                }
                else {
                    window.close();
                }
            });

            $('#dwndate').datepicker({
                format: 'yyyymmdd',
                weekStart: 1,
                autoclose: true,
                todayBtn: 'linked',
                language: 'zh-CN'
            }).on('changeDate',function(ev){

            });

            $('#matdate').datepicker({
                format: 'yyyymmdd',
                weekStart: 1,
                autoclose: true,
                todayBtn: 'linked',
                language: 'zh-CN'
            }).on('changeDate',function(ev){

            });
        });

    </script>

    <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->

</head>
<body>

<div  id ="repaymentSearch"  >
    <div class="col-lg-12" id="parentDiv">
        <div id="searchbar" class="resizeMe">
            <div id="searchInfo">
                <form   name="repaymentQuery"  >
                    <div class="panel panel-default">
                        <div class="panel-heading">
                            <h4 class="panel-title">
                                <a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">还款条件/查询</a>
                                <button id="search" type="button" class="btn btn-primary">搜  索</button>
                                <button id="close" type="button" class="btn btn-primary">关  闭</button>
                            </h4>
                        </div>
                        <div id="collapseOne" class="panel-collapse collapse in">
                            <div class="panel-body">
                                <div class="row" >
                                    <div class="col-lg-4">
                                        <label >开始日期：</label>
                                    </div>
                                    <div class="col-lg-8">
                                        <input id="dwndate" name="dwndate" class="form-control" >
                                    </div>
                                </div>

                                <div class="row" >
                                    <div class="col-lg-4">
                                        <label >结束日期：</label>
                                    </div>
                                    <div class="col-lg-8">
                                        <input  id="matdate" name="matdate" class="form-control" >
                                    </div>
                                </div>

                                <div class="row" >
                                    <div class="col-lg-4">
                                        <label >客户号：</label>
                                    </div>
                                    <div class="col-lg-8">
                                        <input id="custcod" name="custcod" class="form-control" >
                                    </div>
                                </div>

                                <div class="row" >
                                    <div class="col-lg-4">
                                        <label >贷款编码：</label>
                                    </div>
                                    <div class="col-lg-8">
                                        <input id="refno" name="refno" class="form-control" >
                                    </div>
                                </div>

                                <!--<div class="row">-->
                                    <!--<div class="col-lg-4"></div>-->
                                    <!--<div class="col-lg-4">-->
                                        <!--<button type="submit" id="save" class="btn btn-primary">搜  索</button>-->
                                        <!--<button type="reset" class="btn btn-primary">关  闭</button>-->
                                    <!--</div>-->
                                    <!--<div class="col-lg-4"></div>-->
                                <!--</div>-->
                            </div>
                        </div>
                    </div>

                </form>
            </div>

            <div id="tableDiv">
                <div class="panel panel-default">
                    <div class="panel-heading">还款录入</div>
                    <div class="panel-body">
                        <div class="row">
                            <div class="col-lg-12">
                                <table id="tb_repaymentSearch"></table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<label id="divideLine"></label>

<iframe id="iframeMapping" frameborder="0" src=""></iframe>




</body>
</html>